const { mergeConfig } = require("metro-config");
const { getMetroConfig } = require("@tarojs/rn-supporter");

module.exports = (async function () {
  return mergeConfig(
    {
      // custom your metro config here
      // https://facebook.github.io/metro/docs/configuration
      resolver: {},
      server: {
        rewriteRequestUrl: (url) => {
          console.log("url", url);
          if (!url.endsWith(".bundle")) {
            return url;
          }
          // https://github.com/facebook/react-native/issues/36794
          // JavaScriptCore strips query strings, so try to re-add them with a best guess.
          return (
            url +
            "?platform=android&dev=true&lazy=true&minify=false&app=com.playground.taro&modulesOnly=false&runModule=true"
          );
        },
      },
    },
    await getMetroConfig()
  );
})();
